export const tableInfo = {
  localize: {
    search: {
      url: "http://localhost:8080/customer/goods/search"
    },
    preset: {
      status: 1,
      userId: 2
    }
  },
  filters: [
    {
      name: "goodsTypeId",
      label: "物品类型"
    },
    {
      name: "goodsName",
      label: "物品名称"
    },
    {
      name: "customerName",
      label: "客户名称"
    }
  ],
  columns: [
    {
      width: "50",
      label: "#",
      type: "index"
    },
    {
      label: "物品编码",
      name: "code"
    },
    {
      label: "物料编码",
      name: "barcode"
    },
    {
      label: "物品名称",
      name: "name"
    },
    {
      label: "物品类型",
      name: "goodsTypeName"
    },
    {
      label: "客户名称",
      name: "customerName"
    },
    {
      label: "物品价值(元)",
      name: "value"
    },
    {
      label: "规格",
      name: "spec"
    },
    {
      label: "体积(立方米)",
      name: "volume"
    },
    {
      label: "重量(公斤)",
      name: "netWeight"
    },
    {
      label: "毛重(公斤)",
      name: "grossWeight"
    },
    {
      label: "数量单位",
      name: "quantityUnit"
    },
    {
      label: "箱入数",
      name: "quantity"
    },
    {
      label: "创建时间",
      name: "createAt"
    },
    {
      label: "操作",
      name: "action"
    }
  ],
  actions: [
    {
      title: "新增",
      type: "add",
      target: {
        resourceId: "23"
      }
    },
    {
      title: "导入",
      type: "import",
      target: {
        resourceId: "23"
      }
    }
  ]
};
export const typeDialog = {
  title: "新增客户物品信息",
  entries: [
    { name: "name", label: "物品名称" },
    { name: "customerName", label: "客户名称" },
    { name: "goodsTypeName", label: "物品类型" },
    { name: "value", label: "物品价值/元" },
    { name: "spec", label: "规格" },
    { name: "volume", label: "体积(立方米)" },
    { name: "length", label: "长(米)" },
    { name: "width", label: "宽(米)" },
    { name: "netWeight", label: "重量(公斤)" },
    { name: "grossWeight", label: "毛重(公斤)" },
    { name: "quantityUnit", label: "数量单位" },
    { name: "barcode", label: "物料编码" },
    { name: "quantity", label: "箱入数" }
  ],
  actions: [
    {
      title: "保存",
      type: "submit",
      url: "http://localhost:8080/customer/goods"
    },
    { disabled: false, title: "重置", type: "reset" },
    { disabled: false, title: "返回", type: "back" }
  ],
  localize: {
    preset: {
      userId: 1,
      type: 0
    }
  },
  rules: {
    name: [
      { required: true, message: "物品名称不能为空", trigger: "blur" },
      { min: 1, max: 100, message: "长度在 1 到 100 个字符" }
    ],
    customerName: [
      { required: true, message: "客户名称不能为空", trigger: "blur" }
    ],
    goodsTypeName: [
      { required: true, message: "物品类型不能为空", trigger: "blur" }
    ],
    value: [{ required: true, message: "物品价值不能为空", trigger: "blur" }],
    spec: [
      { required: true, message: "规格不能为空", trigger: "blur" },
      {
        pattern: /^(\d{0,7})(\.(\d{0,2}))?$/g,
        message: "最多可输入7位整数，2位小数",
        trigger: "change"
      }
    ],
    volume: [
      { required: true, message: "体积不能为空", trigger: "blur" },
      {
        pattern: /^(\d{0,3})(\.(\d{0,6}))?$/g,
        message: "最多可输入3位整数，6位小数",
        trigger: "change"
      }
    ],
    netWeight: [{ required: true, message: "重量不能为空", trigger: "blur" }],
    quantityUnit: [
      { required: true, message: "数量单位不能为空", trigger: "blur" }
    ]
  }
};

class ViewData {
  constructor({ dirs, actions, entries }) {
    this.dirs = dirs;
    this.actions = actions;
    this.entries = entries;
  }
}

export { ViewData };
